export interface GetAttrListApiParams {
  category1Id: number;
  category2Id: number;
  category3Id: number;
}

/*
  [
    {
      "id": 37,
      "attrName": "分类",
      "categoryId": 1,
      "categoryLevel": 3,
      "attrValueList": [
        {
          "id": 32,
          "valueName": "Java",
          "attrId": 37
        },
        {
          "id": 34,
          "valueName": "JavaScript",
          "attrId": 37
        },
        {
          "id": 33,
          "valueName": "C#",
          "attrId": 37
        }
      ]
    },
  ]
*/

// 属性值列表，不包含isEdit
export interface AttrValueItem {
  id?: number;
  valueName: string;
  // attrId: number;
}
export type AttrValueList = AttrValueItem[];

// 属性值列表，包含isEdit
export interface SaveAttrValueItem extends AttrValueItem {
  isEdit: boolean;
}
export type SaveAttrValueList = SaveAttrValueItem[];

export interface SaveAttrItem {
  id?: number;
  attrName: string;
  attrValueList: SaveAttrValueList;
}

// ts文档：https://juejin.cn/post/7018805943710253086

// Pick从SaveAttrItem类型中挑选"id" | "attrName"，组成一个新类型
// export interface AttrItem extends Pick<SaveAttrItem, "id" | "attrName"> {

// Omit从SaveAttrItem类型中排除"attrValueList"，剩下属性组成一个新类型
export interface AttrItem extends Omit<SaveAttrItem, "attrValueList"> {
  categoryId: number;
  categoryLevel: number;
  attrValueList: AttrValueList;
}

// 属性列表
export type AttrList = AttrItem[];

/*
  类型能复用就复用

  添加参数：
    {
      "attrName": "string",
      "attrValueList": [
        {
          "valueName": "string"
        }
      ],
      "categoryId": 0,
      "categoryLevel": 0,
    }
  更新参数：
    {
      "attrName": "string",
      "attrValueList": [
        {
          "id": 0,
          "valueName": "string"
        }
      ],
      "categoryId": 0,
      "categoryLevel": 0,
      "id": 0
    }
  组件使用
    {
      "attrName": "string",
      "attrValueList": [
        {
          "id": 0,
          "valueName": "string"
          "isEdit": "boolean"
        }
      ],
      "id": 0
    }
*/
